﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////

// NotReviewedButNeeded
#pragma once
#include "IActionModifyBehavior.h"

namespace gcmp
{
    class IUiView;
    class IElement;
    class ISnapCandidates;
    class IMenuItemContainerDefinition;

    /// \brief ModifyAction的默认Behavior，方便定制重载ModifyAction的行为。
    class GCMP_COMMON_EDIT_EXPORT ActionModifyDefaultBehavior : public gcmp::IActionModifyBehavior
    {
    public:
        /// \brief 析构函数
        virtual ~ActionModifyDefaultBehavior() {}

        /// \brief 创建拖拽时显示的影子对象
        /// \see IActionModifyBehavior
        virtual IElement* CreateElementShadow(IUiView* pCurrentView, const ElementId& modifiedElementId) override;

        /// \brief 拖拽对象时，修改对象
        /// \see IActionModifyBehavior
        virtual bool ModifyElement(const IUiView* pCurrentView, const ElementId& modifiedElementId, const gcmp::Vector3d& originPt, const gcmp::Vector3d& moveVector) override;
        
        /// \brief 拖拽夹点时，修改夹点
        /// \see IActionModifyBehavior
        virtual bool ModifyGripPoint(IUiView* pCurrentView, const ElementId& modifiedElementId, const gcmp::Vector3d& originPt, const gcmp::Vector3d& moveVector) override;
        
        /// \brief 修改完成后处理
        /// \see IActionModifyBehavior
        virtual bool ProcessPostModify(IUiView* pCurrentView, const std::vector<ElementId>& modifiedElementIds, const ISnapCandidates* pCurrentSnap = nullptr) override;

        /// \brief 定制ActionModify鼠标右键上下文菜单
        /// \see IActionModifyBehavior
        virtual OwnerPtr<IMenuItemContainerDefinition> PrepareContextMenu(gcmp::IUiView* pUIView) override;

        /// \brief 定制ActionModify鼠标双击行为
        /// \see IActionModifyBehavior
        virtual bool OnLButtonDoubleClick(IUiView* pCurrentView, const gcmp::Vector3d& pos, const ElementId& selectedElementId) override;

        /// \brief 定制ActionModify选择集改变后处理，默认选择集改变刷新激活页面
        virtual void OnSelectionChanged(IDocument* pDocument) override;

        /// \brief 定制ActionModify键盘按下事件处理
        /// \param pCurrentView 当前视图
        /// \param nChar 键盘键值
        /// \return 返回值为true表示已处理，false表示未处理。（系统会根据该返回值决定是否把消息传递到下一个接收者）
        virtual bool OnKeyDown(IUiView* pCurrentView, int nChar) override;

        /// \brief 定制ActionModify键盘弹起事件处理
        /// \param pCurrentView 当前视图
        /// \param nChar 键盘键值
        /// \return 返回值为true表示已处理，false表示未处理。（系统会根据该返回值决定是否把消息传递到下一个接收者）
        virtual bool OnKeyUp(IUiView* pCurrentView, int nChar) override;

    };
}
